import { Urls } from './urls'
import sfetch from 'sfetch'
import * as pub from './public';
import { api_Ip, lesson_api_IP, upload_IP, upload_interwork_IP } from './serverIp' 

/*
refreshldToken
 */
export const refreshTken = () => {
    let body = {};
    body.requestFlag = 'pc';
    body = pub.behavior(body, '', '');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/refreshldToken/getnewldToken',
            body: body,
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
添加课程
 */
export const addCourse = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(upload_IP + '/eLearning/Course/saveCourse', 'saveCourse', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
修改课程 
 */
export const updateCourse = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(upload_IP + '/eLearning/Course/updateCourse', 'updateCourse', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}

/*
删除课程 /eLearning/TestPaper/deleteTestPaper
 */
export const delCourse = (bM = {}) => {
    let body = pub.behavior(bM, 'deleteCourse', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/deleteCourse',
            body: body,
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
删除综合考题 /eLearning/TestPaper/deleteTestPaper
 */
export const delQuestion = (body = {}) => {
    body = pub.behavior(body, 'deleteTestPaper', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/TestPaper/deleteTestPaper',
            body: body,
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
获得综合考题 testPaperOnlineAnswer
 */
export const getTestPaper = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/TestPaper/testPaperOnlineAnswer',
            body: body,
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
提交综合考题 /eLearning/TestPaper/submTestPaperTitle
 */
export const subTestPaper = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(lesson_api_IP + '/eLearning/TestPaper/submTestPaperTitle', 'mainPage', 'menu'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
提交审核课程
 */

export const subCourse = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(lesson_api_IP + '/eLearning/Course/submCourse', 'submCourse', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            // console.log(data)
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}

/*
学生获取课程列表
 */
export const getCourse = (currentPage, checkState, courseType, courseName, elecReqCourse) => {
    let body = {};
    if (currentPage !== '') {
        body.currentPage = currentPage;
    }
    if (checkState !== '') {
        body.checkState = checkState;
    }
    if (courseType !== '') {
        body.courseType = courseType;
    }
    if (courseName !== '') {
        body.courseName = courseName;
    }
    if (elecReqCourse !== '') {
        body.elecReqCourse = elecReqCourse;
    }

    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/studentSelectCoursePager',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
教师获取课程列表
 */
export const teacherGetCourse = (currentPage, checkState, courseType, courseName) => {
    let body = {};
    if (currentPage !== '') {
        body.currentPage = currentPage;
    }
    if (checkState !== '') {
        body.checkState = checkState;
    }
    if (courseType !== '') {
        body.courseType = courseType;
    }
    if (courseName !== '') {
        body.courseName = courseName;
    }
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/teacherSelectCoursePager',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
管理员获取课程列表
 */
export const adminGetCourse = (currentPage, checkState, courseType, courseName) => {
    let body = {};
    if (currentPage !== '') {
        body.currentPage = currentPage;
    }
    if (checkState !== '') {
        if (checkState === 'U') {
            body.courseState = checkState;
        } else {
            body.checkState = checkState;
        }
    }
    if (courseType !== '') {
        body.courseType = courseType;
    }
    if (courseName !== '') {
        body.courseName = courseName;
    }


    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/adminSelectCoursePager',
            body: body,
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
提交课程审核
 */
export const submCourse = (bM = {}) => {
    // let body = {
    //   courseId: id,
    // }
    let body = pub.behavior(bM, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/submCourseById', //'/eLearning/Course/submCourse',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
在线答题获取题目列表
 */
export const onlineAnswer = (id) => {
    let body = {
        courseId: id,
    }
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/onlineAnswer',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
课程审核
 */
export const checkCourse = (formData) => {
    // body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(lesson_api_IP + '/eLearning/Course/checkCourse', 'mainPage', 'menu'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
在线答题提交分数
 */
export const submitScore = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(lesson_api_IP + '/eLearning/Course/submCourseTitle', 'mainPage', 'menu'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
随机答题提交分数
 */
export const submitRandomScore = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(lesson_api_IP + '/eLearning/randomTitle/submRandomCourseTitle', 'mainPage', 'menu'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
课程详情
 */
export const courseDetail = (id) => {
    let body = {
        courseId: id,
    }
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/loadCourse',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
进入审核页面
 */
export const clickCheck = (id) => {
    let body = {
        courseId: id,
    }
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/clickCheck',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
综合考题管理
 */
export const questionManage = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/TestPaper/selectTestPaper',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/*
添加综合考题
 */
export const addQuestion = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(lesson_api_IP + '/eLearning/TestPaper/savetestPaper', 'mainPage', 'menu'),
            //lesson_api_IP + '/eLearning/TestPaper/savetestPaper',
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            // console.log(data)
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
编辑综合考题
/eLearning/TestPaper/updateTestPaper
 */
export const editQuestion = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(lesson_api_IP + '/eLearning/TestPaper/updateTestPaper', 'mainPage', 'menu'),
            //lesson_api_IP + '/eLearning/TestPaper/savetestPaper',
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            // console.log(data)
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
//查看随机考试
export const SeeQuestion = (body = {}) => {
    return new Promise((resolve, reject) => {

        sfetch.post({
            url: pub.url_format(lesson_api_IP + '/eLearning/randomTitle/selectRandomTitle', 'mainPage', 'menu'),
            //lesson_api_IP + '/eLearning/TestPaper/savetestPaper',
            body: body,
        }).then((data) => {
            //console.log(data)
            if (data.ok) {
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
查看考题
 */
export const questionDetail = (id) => {
    let body = {
        testpaperId: id,
    }
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/TestPaper/loadTestPaper',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
排行榜
 */
export const rank = () => {
    let body = {};
    body = pub.behavior(body, 'topindex', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/top/topindex',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
点赞收藏课程
 */
export const operateCourse = (id, type) => {
    let body = {
        courseId: id,
        recordType: type,
    }
    body = pub.behavior(body, 'operateCourse', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/thriftClient/operateCourse',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
//兑换课程
export const operateCourses = (id) => {
    let body = {
        courseId: id,
    }
    body = pub.behavior(body, 'operateCourses', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/thriftClient/cashCourse',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
//精品文章兑换
export const articletext = (id, code) => {
    let body = {
        essayId: id,
        userCode: code,
    }
    body = pub.behavior(body, 'cashessay', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/essaycenter/cashessay',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
点赞收藏文章
 */
export const operateArticle = (id, type) => {
    let body = {
        essayId: id,
        recordType: type,
    }
    body = pub.behavior(body, 'operateEssay', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/essaycenter/operateessay',
            body: body,
            timeout: 5000,
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
学霸榜
 */
export const rankStudent = (topType, pageno) => {
    let body = {};
    body.topType = topType;
    body.pageno = pageno;
    body = pub.behavior(body, 'studenttop', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/top/studenttop',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
集赞榜
 */
export const rankCourse = (topType, pageno) => {
    let body = {};
    body.topType = topType;
    body.pageno = pageno;
    body = pub.behavior(body, 'coursetop', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/top/coursetop',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
学生详情
 */
export const studentDetail = (name) => {
    let body = {};
    body.name = name;
    body = pub.behavior(body, 'studentdetail', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/top/studentinformation',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
教师详情
 */
export const teacherDetail = (name) => {
    let body = {};
    body.name = name;
    body = pub.behavior(body, 'teacherdetail', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/top/teacherinformation',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}

/*
登录
 */
export const login = (phone, password) => {
    let body = {};
    body.userCode = phone;
    body.passWord = password;
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/login/dologin',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
获取验证码
 */
export const getPhoneCode = (phone) => {
    let body = {};
    body.phone = phone;
    body = pub.behavior(body, 'getPhoneCode', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/updatePwd/getPhoneCode',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
找回密码
 */
export const changePassword = (phone, phoneCode, password) => {
    let body = {};
    body.phone = phone;
    body.phoneCode = phoneCode;
    body.newPassWord = password;
    body = pub.behavior(body, 'submitUpdatePwd', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/updatePwd/submitUpdatePwd',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
文章管理
 */
export const articleManage = (pageno, checkState, essayTitle) => {
    let body = {}
    if (pageno !== '') {
        body.pageno = pageno;
    }
    if (checkState !== '') {
        if (checkState !== '6') {
            body.checkState = checkState;
        }
    }
    if (checkState === '') {
        body.operationState = 1;
    } else if (checkState === '6') {
        body.operationState = 2;
    }
    if (essayTitle !== '') {
        body.essayTitle = essayTitle;
    }

    body = pub.behavior(body, 'listEssays', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/essaymanager/essaylist',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}

/*
设置精品课程
 */
export const setGoodArticle = (bM = {}) => {
    let body = pub.behavior(bM, 'setOrCancelEssay', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/essaymanager/setorcancel',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
下架课程
 */
export const delArticle = (id) => {
    let body = {};
    body.essayId = id;
    body.operationState = 'D';
    body = pub.behavior(body, 'essayOperation', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/essaycenter/insertorupdate',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
发布消息
 */

export const addMessage = (informationTitle, inforURL, informationNote, informationType) => {
    let body = {};
    body.informationTitle = informationTitle;
    body.inforURL = inforURL;
    body.informationNote = informationNote;
    body.operationState = 'A';
    body.informationType = informationType
    body = pub.behavior(body, 'insertInformation', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/messagecentermanagement/insert',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
图书管理 A U D /bookmanagerment/operation
 */
export const bookManage = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(upload_interwork_IP + '/bookmanagerment/operation', 'bookOperation', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
删除图书 
 */
export const removeBook = (formData) => {
    // let body={
    //   bookId:id
    // }
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(api_Ip + '/bookmanagerment/delete', 'bookOperation', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/*
注销
 */
export const loginOut = () => {
    let body = {};
    body = pub.behavior(body, 'logout', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/home/logout',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
签到
 */
export const sign = () => {
    let body = {};
    body.code = '1';
    body = pub.behavior(body, 'sign', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/home/sign',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
审核文章
 */
export const checkArticle = (body) => {
    body = pub.behavior(body, 'auditEssay', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/essaymanager/auditessay',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
审核文章页面
 */

export const checkArticlePage = (body) => {
    body = pub.behavior(body, 'selectaudit', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/essaymanager/selectauditessay',
            body: body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
首页菜单栏接口
 */
export const header = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/home/header',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
设置精品课程
 */
export const setGoodCourse = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: lesson_api_IP + '/eLearning/Course/isGoodCourse',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
故事线
 */
export const storyLine = (body = {}) => {
    body = pub.behavior(body, 'storyline', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/storyline/selectuserdetail',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}

/*
查询商品列表
 */
export const goodType = (body = {}) => {
    body = pub.behavior(body, 'categoriesList', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/book/prepareinsertbook',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
查询商品列表
 */
export const setGoodType = (body = {}) => {
    body = pub.behavior(body, 'categoriesList', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/categories/categorieslist',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
 新增修改商品类别 /categories/iudgoodscategories
 */
export const categoriesManage = (body = {}) => {
    body = pub.behavior(body, 'iudGoodsCategories', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/categories/iudgoodscategories',
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}

/*
查看课程类别 /eLearning/Course/selectcourseType
 */

/**
 * 蜂行圈接口：/essaycenter/essaylist
 * 请求方式：GET
 * 请求参数：{pageNo: 1,operationType:'essayList',behaviorDataType:'menu'}
 * by QianLi 2017-8-23
 */
export const getEssaylist = (bM = {}) => {
    let body = pub.behavior(bM, 'essayList', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.ESSAYLIST,
            body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}

/** 
 * 蜂行圈获取文章详情接口：/essaycenter/selectessay
 * 请求方式：GET
 * 请求参数：{recordId: 1,recordType:'x',operationType:'selectEssay',behaviorDataType:'button'}
 *  by QianLi 2017-8-24
 */
export const getSelectessay = (bM = {}) => {
    let body = pub.behavior(bM, 'selectEssay', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.SELECTESSAY,
            body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}

/**
 * 学习动态接口：/coursemanagement/click 
 * 请求方式：Get
 * 请求参数：{pageno:'x',userName:'xxx',operationTypes:'dynamic',behaviorDataType:'menu'}
 */
export const courseClick = (bM = {}) => {
    let body = pub.behavior(bM, 'dynamic', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.COURSECLICK,
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 文章动态接口：/essaycenter/essay 
 * 请求方式：Get
 * 请求参数：{pageno:'x',userName:'xxx',operationTypes:'dynamic',behaviorDataType:'menu'}
 */
export const essayClick = (bM = {}) => {
    let body = pub.behavior(bM, 'dynamic', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.ESSAYCLICK,
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 学习动态课程更多接口：/coursemanagement/moreclick
 * 请求方式：Get
 * 请求参数：{pageno:'x'userName:'xxx'operationTypes:'courseDynamic'behaviorDataType:'button'}
 */
export const courseMore = (bM = {}) => {
    let body = pub.behavior(bM, 'courseDynamic', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.COURSEMORE,
            body: body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 学习动态锋行圈更多接口：/essaycenter/moreessay
 * 请求方式：Get
 * 请求参数：{pageno:'x'userName:'xxx'operationTypes:'essayDynamic'behaviorDataType:'button'}
 */
export const moreEssay = (bM = {}) => {
    let body = pub.behavior(bM, 'essayDynamic', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.MOREESSAY,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 我的课程收藏接口接口：/coursemanagement/collection
 * 请求方式：Get
 * 请求参数：{pageno:'x'courseName:'xxxx'userName:'xxxx'operationTypes:'courseCollection'behaviorDataType:'menu'}
 */
export const courseCollection = (bM = {}) => {
    let body = pub.behavior(bM, 'courseCollection', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.COURSECOLLECTION,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 我的锋行圈收藏接口：/essaycenter/morecolessay
 * 请求方式：Get
 * 请求参数：{pageno:'x'operationTypes:'essayCollection'behaviorDataType:'menu'}
 */
export const moreColessay = (bM = {}) => {
    let body = pub.behavior(bM, 'essayCollection', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.MORECOLESSAY,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 图书管理显示所有图书(全部，上架、下架，分类，渠道）接口：/bookmanagerment/list
 * 请求方式：Get
 * 请求参数：{bookName:'xxxx'pageno: 'x'bookType:'x'userName:'xxx'operationTypes:'Library'behaviorDataType:'menu'}
 */
export const bookmanagermentList = (bM = {}) => {
    let body = pub.behavior(bM, 'Library', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.BOOKMANAGERMENTLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/**
 * 图书馆（资料库）显示所有图书(分类）接口：/book/list
 * 请求方式：Get
 * 请求参数：{bookName:'xxxx'bookState：'x'pageno: 'x'bookType:'x'userName:'xxxx'operationTypes:'Library'behaviorDataType:'menu'}
 */
export const bookList = (bM = {}) => {
    let body = pub.behavior(bM, 'Library', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.BOOKLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 我的书架接口接口：/book/mylist 
 * 请求方式：Get 
 * 请求参数：{bookName:'xxxx'pageno: 'x'userName:'xxxx'operationTypes:'myBookshelf'behaviorDataType:'menu'}
 */
export const bookmyList = (bM = {}) => {
    let body = pub.behavior(bM, 'myBookshelf', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.BOOKMYLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 图书兑换接口:/book/cashBook 
 * 请求类型：Post 
 * 请求参数：{bookId:’xx’userName:'xxx'operationTypes:'caseBook'behaviorDataType:'button'}
 */
export const bookCashbook = (bM = {}) => {
    let body = pub.behavior(bM, 'caseBook', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.BOOKCASHBOOK,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 图书新增、上架、下架接口：/bookmanagerment/operation
 * 请求方式：Post
 * 请求参数{bookId:'x'bookPath:'xxxxx'bookName:'xxxx'bookState:'xAuthor:'xxx'Press:'xxx'Subhead:'xxx'originalAuthor:'xxx'Translator:'xxx'publishYear:'xxxx'Pages:'x'cashIntegral:'xx'bookEntityPath:'xx'userName:'xxx'operationTypes:'bookOperation'behaviorDataType:'button'}
 */
export const bookOperation = (bM = {}) => {
    let body = pub.behavior(bM, 'bookOperation', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.BOOKOPERATION,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 图书编辑接口接口：/bookmanagerment/update
 * 请求方式：Post
 * 请求参数{bookId:'x'bookPath:'xxxxx'bookName:'xxxx'bookState:'x'Author:'xxx'Press:'xxx'Subhead:'xxxoriginalAuthor:'xxx'Translator:'xxx'publishYear:'xxxx'Pages:'x'cashIntegral:'xx'bookEntityPath:'xx'userName:'xx'operationTypes:'bookOperation'behaviorDataType:'button'}
 */
export const bookUpdate = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(Urls.BOOKUPDATE, 'bookOperation', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 个人中心积分详情接口：/integralmall/userLogList 
 * 请求方式：Get 
 * 请求参数：{pageno:'xx',beginDate:'yyyy-MM-dd',endDate:'yyyy-MM-dd'userName:'xx'operationTypes:'bookOperation'behaviorDataType:'menu'}
 */
export const userLoglist = (bM = {}) => {
    let body = pub.behavior(bM, 'bookOperation', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.USERLOGLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 个人中心个人名片接口：/useranalysis/getone 
 * 请求方式：Get 
 * 请求参数：{userName:'xxx'operationTypes:'personCard'behaviorDataType:'menu'}
 */
export const getOne = (bM = {}) => {
    let body = pub.behavior(bM, 'personCard', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.GETONE,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 个人中心个人名片编辑名片接口：/useranalysis/update 
 * 请求方式：Post 
 * 请求参数：{headPath:'',seifInformation:''userName:'x'operationTypes:'personCardUpdate'behaviorDataType:'button'}
 */
export const analysisUpdate = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(Urls.ANALYSISUPDATE, 'personCardUpdate', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 我的锋行圈接口：/essaycenter/myessaylist 
 * 请求方式：Get 
 * 请求参数：{pageNo: 1,operationState: 'x'userName:’xxx’operationTypes:'myEssay'behaviorDataType:'menu'}
 */
export const myessayList = (bM = {}) => {
    let body = pub.behavior(bM, 'myEssay', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.MYESSAYLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 个人中心我的文章查看接口：/essaycenter/selectessay 
 * 请求方式：Get 
 * 请求参数：{recordId: 1,userName:’xx’operationTypes:'personCardUpdate'behaviorDataType:'button'}
 */
export const aelectessay = (bM = {}) => {
    let body = pub.behavior(bM, 'personCardUpdate', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.AELECTESSAY,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 文章增加、编辑、下架接口：后台/essaycenter/insertorupdate 
 * 请求方式：POST 
 * 请求参数：{essayId:essayTitle:'xxx',essayNote:'xx',operationState:'xx',essayPhotoPath:'xxxxxxx',userName:'xx'operationTypes:'essayOperation'behaviorDataType:'button'}
 */
export const integralMall = (formdata) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(Urls.INTEGRALMALL, 'essayOperation', 'button'),
            body: formdata,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 文章增加、编辑、下架接口：前台
 */
export const insertorupdate = (formdata) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(Urls.INSERTORUPDATE, 'essayOperation', 'button'),
            body: formdata,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 2017/12/4
 * 文章删除/上架/essaycenter/upordelete
*/
export const essayupordetlete = (bM = {}) => {
    let body = pub.behavior(bM, 'upordelete', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.ESSAYUPORDELETE,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}

/**
 * 积分商城接口：/integralmall/list 
 * 请求方式：Get 
 * 请求参数：{commodityType  :'x'shopName:'xxx'pageno:'x'operationTypes:'IntegralMall'behaviorDataType:'menu'}
 */
export const integralList = (bM = {}) => {
    let body = pub.behavior(bM, 'IntegralMall', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.INTEGRALLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 积分商城后台管理接口：/integralmallmanagement/list 
 * 请求方式：Get
 * 请求参数：{commodityType  :'x'shopName:'xxx'pageno:'x'operationTypes:'IntegralMall'behaviorDataType:'menu'}
 */
export const integralmallList = (bM = {}) => {
    let body = pub.behavior(bM, 'IntegralMall', 'menu');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.INTEGRALMALLLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 积分商城兑换接口:/integralmall/change 
 * 请求类型：Post 
 * 请求参数：{shopId:’xx’userName:’xx’operationTypes:'IntegralChange'}
 */
export const integralChange = (bM = {}) => {
    let body = pub.behavior(bM, 'IntegralChange');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.INTEGRALCHANGE,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 查看图书类别接口:/book/prepareinsertbook 请求方式：Get 请求参数：{operationTypes:'IntegralChange'behaviorDataType:'button'}
 */
export const prepareinsertBook = (bM = {}) => {
    let body = pub.behavior(bM, 'IntegralChange', 'button');
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.PREPAREINSERTBOOK,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 首页接口：/home/index
 * 请求方式：GET
 * 请求参数：{operationType:'mainPage',behaviorDataType:'menu'}
 */
export const home = (body = {}) => {

    body = pub.behavior(body, 'mainPage', 'menu')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.HOME,
            body,
            timeout: 5000
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 查看商品类别(用于新增商品，修改商品类别)接口：/categories/categorieslist
 * 请求方式：GET
 * 请求参数：{operationType:'categoriesList',behaviorDataType:'button'}
 */
export const categoriesList = (bM = {}) => {

    let body = pub.behavior(bM, 'mainPage', 'menu')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.CATEGORIESLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/**
 * 24.用户会员名片信息接口：/useranalysis/getmoreone
 * 请求方式：Get
 * 请求参数：{userCode:'xxx'operationTypes:'personCard'behaviorDataType:'menu'}
 */
export const getMoreone = (body = {}) => {

    body = pub.behavior(body, 'personCard', 'menu')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.GETMOREONE,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 直播通道接口：/live/liveinfolist
 * 请求方式：GET
 * 请求参数：{pageNo:6,operationTypes:'selectLiveInfo',behaviorDataType:'button'}
 */
export const liveinfolist = (body = {}) => {

    body = pub.behavior(body, 'selectLiveInfo', 'button')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.LIVEINFOLIST,
            body
        }).then((data) => {
            pub.checkLogin(data.json);
            resolve(data.json)
        });

    });
}

/**
 * 查询全部图书接口：/bookmanagerment/list
 * 请求方式：GET
 * 请求参数：{bookName:'xxxx',pageno: 'x',bookType:'x',userCode:'xxx',operationTypes:'Library',behaviorDataType:'menu'}
 */
export const bookManageList = (body = {}) => {

    body = pub.behavior(body, 'Library', 'menu')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.BOOKMANAGELIST,
            body
        }).then((data) => {
            pub.checkLogin(data.json);
            resolve(data.json)
        });
    });
}

/**
 * 查询全部消息接口：/messagecentermanagement/allinformation
 * 请求方式：GET
 * 请求参数：{pageNo: 1,userName:'xxxxx'operationType:'allInformation',behaviorDataType:'menu'}
 */
export const messageList = (body = {}) => {

    body = pub.behavior(body, 'allInformation', 'menu')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.MESSAGELIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/**
 * 25.查询图书详情接口：/bookmanagerment/selectbook
 * 请求方式：Get
 * 请求参数：{ bookId：’x’,operationTypes:’selectbook’,behaviorDataType:’'button'’}
 */
export const selectBook = (body = {}) => {

    body = pub.behavior(body, 'selectbook', 'button')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.SELECTBOOK,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/**
 * 26.提交文章审核接口：/essaycenter/submit
 * 请求方式：Get
 * 请求参数：{essayId:''operationTypes:'submit'behaviorDataType:'button'}
 */
export const submitEssSh = (body = {}) => {

    body = pub.behavior(body, 'submit', 'button')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.SUBMITESSSH,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/**
 * 未读消息接口：/messagecenter/unreadinformationlist请求方式：GET
 * 请求参数：{userCode:xx,pageno: 1,operationType:'unreadInformation',behaviorDataType:'menu'}
 */
export const unreadList = (body = {}) => {

    body = pub.behavior(body, 'unreadInformation', 'menu')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.UNREADLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/**
 * 已读消息接口：/messagecenter/readinformationlist
 * 请求方式：GET
 * 请求参数：{userCode:xx,pageno: 1,operationType:'readInformation',behaviorDataType:'menu'}
 */
export const readList = (body = {}) => {

    body = pub.behavior(body, 'readInformation', 'menu')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.READLIST,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
//查看消息接口
export const viewmessage = (id) => {
    let body = {
        informationId: id,

    }
    body = pub.behavior(body, 'markInformation', 'button')

    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.VIEWMESSAGE,
            body
        }).then((data) => {
            pub.checkLogin(data.json);
            resolve(data.json)
        });
    });
}

/**
 * 课程类型查询接口
 */
export const selectcourseType = (body = {}) => {

    body = pub.behavior(body)
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.SELECTCOURSETYPE,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 渠道
 */
export const selectChnnelByUserCode = (body = {}) => {

    body = pub.behavior(body)
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.SELECTCHNNEL,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 文章兑换
 */
export const cashEssay = (body = {}) => {

    body = pub.behavior(body, 'cashessay', 'button')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: Urls.CASHESSAY,
            body
        }).then((data) => {
            pub.checkLogin(data.json);
            resolve(data.json)
        });
    });

}
/**
 * 新增/修改荣誉称号/honor/opreration
 */
export const oprerationHonor = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(upload_interwork_IP + '/honor/opreration', 'submit', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });

    });
}
/**
 * 根据荣誉称号Id得到该荣誉称号/honor/selectone
 */
export const selectoneHonor = (body = {}) => {
    body = pub.behavior(body, 'submit', 'button')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/honor/selectone`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 得到所有荣誉称号/honor/selectall
 */
export const selectallHonor = (body = {}) => {
    body = pub.behavior(body, 'honor', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/honor/selectall`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 查看答题历史信息/eLearning/Course/selectExamDetail
 */
export const selectExamDetail = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${lesson_api_IP}/eLearning/Course/selectExamDetail`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}

/**
 * 综合考题答题记录eLearning/TestPaper/selectBigTestExamDetail
 */
export const selectBigTestExamDetail = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${lesson_api_IP}/eLearning/TestPaper/selectBigTestExamDetail`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}

//查看随机答题记录
export const selectRandomTestExamDetail = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${lesson_api_IP}/eLearning/randomTitle/selectRandomTestExamDetail`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 *honor/myhonor//称号个人名片显示荣誉
 */
export const myHonor = (body = {}) => {
    body = pub.behavior(body, 'honor', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/honor/myhonor`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 *honor/myhonor//称号个人名片显示荣誉App
 */
export const myHonorApp = (search) => {
    let body = {}
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/honor/myhonor` + search,
            body
        }).then((data) => {
            if (data.ok) {
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 *certificate/allcertificate/称号个人名片显示荣誉
 */
export const allCertificate = (body = {}) => {
    body = pub.behavior(body, 'certificate', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/certificate/allcertificate`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
*certificate/allcertificate/称号个人名片显示荣誉(分享)
*/
export const allCertificateShare = (search) => {
    let body = {};
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/certificate/allcertificate` + search,
            body
        }).then((data) => {
            if (data.ok) {
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 *integralmall/levelset/积分规则
 */
export const levelSet = (body = {}) => {
    body = pub.behavior(body, 'certificate', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/integralmall/levelset`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
   *useranalysis/getagentchangeList成长历程
   */
export const getAgentchangeList = (body = {}) => {
    body = pub.behavior(body, 'getagentchangeList', 'button')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/useranalysis/getagentchangeList`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
   *appuseranalysis/getagentchangeList成长历程(App)
   */
export const getAgentchangeApp = (search) => {
    let body = {};
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/appuseranalysis/getagentchangeList` + search,
            body
        }).then((data) => {
            if (data.ok) {
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
   *useranalysis/selectrealname根据用户账号得到用户真实姓名
   */
export const selectRealname = (body = {}) => {
    body = pub.behavior(body, 'personName', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/useranalysis/selectrealname`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
//App个人名片
export const myHomeApp = (search) => {
    let body = {};
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: api_Ip + '/appuseranalysis/myhome' + search,
            body: body
        }).then((data) => {
            if (data.ok) {
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}


/*
 * / privateletter/ addresseeprivateletter私信主题接口
*/

export const addresseePrivateLetter = (pageno, now_userType) => {
    let body = {
        start: pageno,
        userType: now_userType
    }
    body = pub.behavior(body, 'privateletter', 'button')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/privateletter/addresseeprivateletter`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}



/*
 * 发送私信详情
 接口：/ privateletterinfo/ sendletterinfo
 * */
export const sendLetterInfo = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(api_Ip + '/privateletterinfo/sendletterinfo', 'privatelettsenderletter', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}

/*
 * 发送私信主题
 接口：/privateletter/sendletter
 * */
export const sendLetterTheme = (formData) => {
    return new Promise((resolve, reject) => {
        sfetch.post({
            url: pub.url_format(api_Ip + '/privateletter/sendletter', 'privatelettsenderletter', 'button'),
            body: formData,
            dataType: 'formdata'
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}

/*
 * / privateletter/ senderprivateletter私信主题接口（当前用户为学员时）
*/

export const letterinfo = (body = {}) => {

    body = pub.behavior(body, 'privateletter', 'button')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/privateletterinfo/letterinfo`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}


/*
 * /privateletter/delletter删除私信主题
*/

export const delletter = (body = {}) => {

    body = pub.behavior(body, 'privatelettdeleter', 'button')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/privateletter/delletter`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 34.查询个人名片点赞总数/useranalysis/sumoperation
*/
export const sumOperation = (search) => {

    let body = {};
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/appuseranalysis/sumoperation` + search,
            body
        }).then((data) => {
            if (data.ok) {
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 个人名片点赞接口/useranalysis/opcardislike
*/
export const opcardIslike = (search) => {

    let body = {};
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/appuseranalysis/opcardislike` + search,
            body
        }).then((data) => {
            if (data.ok) {
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 删除,下架，上架课程信息，课程附件信息，考题信息及答案描述信息/eLearning/Course/deleteCourse
*/
export const deleteManCourse = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${lesson_api_IP}/eLearning/Course/deleteCourse`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 删除,下架，上架课程信息，课程附件信息，考题信息及答案描述信息/eLearning/TestPaper/deleteTestPaper
*/
export const deleteTestPaper = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${lesson_api_IP}/eLearning/TestPaper/deleteTestPaper`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 用户分析
 * 统计表接口：/report/getreport
*/
export const getReport = (body = {}) => {
    body = pub.behavior(body, 'getReport', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/report/getreport`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 用户分析
 * 下载统计表接口：/report/downloadreportexcel
*/
export const downLoadreportexcel = (body = {}) => {
    body = pub.behavior(body, 'getReport', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/report/downloadreportexcel`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 学员明细接口：/dataanalysis/studentdetail
*/
export const studentsDetail = (body = {}) => {
    body = pub.behavior(body, 'studentDetail', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/dataanalysis/studentdetail`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 讲师明细表接口：/dataanalysis/teacherdetail
*/
export const teachersDetail = (body = {}) => {
    body = pub.behavior(body, 'teacherDetail', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/dataanalysis/teacherdetail`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/**
 * 下载学员/讲师名表接口：/download/downloadexcel
*/
export const downLoadexcel = (body = {}) => {
    body = pub.behavior(body, 'downloadExcel', 'button')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/download/downloadexcel`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });

}
/**
 * 36.积分商城上架、删除接口：/integralmallmanagement/upordelete
*/
export const uporPSDelete = (body = {}) => {
    body = pub.behavior(body, 'integralOperation', 'button')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${api_Ip}/integralmallmanagement/upordelete`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
/eLearning/Course/selectVideoTimes
 */
export const selectVideoTimes = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${lesson_api_IP}/eLearning/Course/selectVideoTimes`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
/*
/eLearning/Course/saveVideoTimes
 */
export const saveVideoTimes = (body = {}) => {
    body = pub.behavior(body, 'mainPage', 'menu')
    return new Promise((resolve, reject) => {
        sfetch.get({
            url: `${lesson_api_IP}/eLearning/Course/saveVideoTimes`,
            body
        }).then((data) => {
            if (data.ok) {
                pub.checkLogin(data.json);
                resolve(data.json)
            } else {
                reject(data)
            }
        });
    });
}
